<?php

namespace App\Model;


use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class RoomDynamicLog extends BaseModel
{
    protected $connection = 'api';
    protected  $table = 'room_dynamic_log';

    public function getList(Request $request)
    {
        $page = $request->get('page', 1);
        $limit = $request->get('limit', 10);
        //$dynamic_id = $request->input('dynamic_id');
        $query = new RoomDynamicLog();
        //if ($dynamic_id) $query = $query->where('dynamic_id', $dynamic_id);
        return DB::connection($this->connection)->table($this->table)
            ->leftJoin('room_dynamic',$this->table . '.dynamic_id', '=', 'room_dynamic.id')
            ->leftJoin('room',$this->table . '.room_id', '=', 'room.room_id')
            ->select('room.room_uid','room.name as room_name','room_dynamic.id','room_dynamic_log.start_time','room_dynamic_log.end_time','room_dynamic.name')
            ->get();
    }
}


